package revir;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class hgf {
    public static void main(String[] args) {
        Runnable printA = new PrintChar("hello", 50);
        Runnable printB = new PrintChar("goodbye", 50);
        Runnable print100 = new PrintNum(2);

        // Create threads
        Thread thread1 = new Thread(printA);
        Thread thread2 = new Thread(printB);
        Thread thread3 = new Thread(print100);

        // Start threads
        thread1.start();
        thread2.start();
        thread3.start();
    }
}

// The task for printing a specified character in specified times
class PrintChar implements Runnable {
    private String charToPrint; // The character to print
    private int times; // The times to repeat

    /** Construct a task with specified character and number of
     *  times to print the character
     */
    public PrintChar(String c, int t) {
        charToPrint = c;
        times = t;
    }

    /** Override the run() method to tell the system
     *  what the task to perform
     */
    public void run() {
        for (int i = 0; i < times; i++) {
            System.out.print(charToPrint);
        }
    }
}

// The task class for printing number from 1 to n for a given n
class PrintNum implements Runnable {
    private List<String> lastNum;

    /** Construct a task for printing 1, 2, ... i */
    public PrintNum(int n) {

        List<String> stringList;
        stringList = Arrays.asList("name:kk","age:20","time:3");
        lastNum = stringList;
    }

    /** Tell the thread how to run */
    public void run() {
        {
            System.out.println(lastNum);
        }
    }
}

